<%@ page language="java" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="sf " uri="http://www.springframework.org/tags/form"%>
<%@ taglib prefix="s " uri="http://www.springframework.org/tags"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt"%>
<!DOCTYPE html>
<html>
<head>
<title>添加合同</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="renderer" content="webkit">
<%@ include file="/WEB-INF/common.jsp"%>

<link href="${path }/resources/css/plugins/bootstrap-table/bootstrap-table.min.css" rel="stylesheet">
<link href="${path }/resources/css/animate.css" rel="stylesheet">
<link href="${path }/resources/css/style.css?v=4.1.0" rel="stylesheet">

<!--dataTables css样式-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/jquery.dataTables.min.css">
<!--DataTables button扩展-->
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/buttons.dataTables.min.css">
<link rel="stylesheet" type="text/css"
	href="${path }/resources/css/form.css">
<link href="${ contextPath }/res/sys/scripts/css/jquery.editable-select.min.css" rel="stylesheet">


</head>
<style type="text/css" rel="stylesheet">
        #province {
            width:150px;
            margin-left:20px;
            display:inline-block;
        }
        #city{
            width:150px;
            margin-left:20px;
            display:inline-block;
        }
        #district{
            width:150px;
            margin-left:20px;
            display:inline-block;
        } 
</style>
<body class="gray-bg" style="">
<jsp:include page="/WEB-INF/loginCheck.jsp" />
	<div>
		<h1 style="margin-left:20px">添加合同</h1>
	</div>
	<hr>
	<!--修改的表单  -->
	<div id="" barclass="panel-body" style="margin-top: 30px">
<form id="defaultForm" action="${path }/contract/addContract.htm" method="post" data-parsley-validate data-parsley-validate class="form-horizontal form-label-left" enctype="multipart/form-data"> 
			<!-- <form data-parsley-validate data-parsley-validate class="form-horizontal form-label-left" enctype="multipart/form-data"> -->
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">项目名称：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="projectName" class="form-control col-md-7 col-xs-12"
					>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="first-name">业主名称<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="" class="selectpicker form-control" data-live-search="true" name="proprietorId">
				      <c:forEach items="${allProprietor}" var="allProprietor" >
							<option value="${allProprietor.id}"><c:out value="${allProprietor.name}"/></option>
						</c:forEach>
					</select>
				</div>
			</div>
				<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="first-name">项目负责人：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<select id="" class="selectpicker form-control" data-live-search="true" name="projectCharge">
				      <c:forEach items="${manager}" var="manager" >
							<option value="${manager.id}"><c:out value="${manager.name}"/></option>
						</c:forEach>
					</select>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">所属城市：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<div id="distpicker5">
						<div class="form-group" id="province">
							<label class="sr-only" for="province">Province</label> <select
								class="form-control" id="province" name="province" ></select>
						</div>
						<div class="form-group" id="city">
							<label class="sr-only" for="city">City</label> <select
								class="form-control" id="city" name="city" ></select>
						</div>
						<div class="form-group" id="district">
							<label class="sr-only" for="district">District</label> <select
								class="form-control" id="district" name="area" ></select>
						</div>
					</div>
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">详细地址<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="address" class="form-control col-md-7 col-xs-12">
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">城市合伙人：
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  value="" name="cityPartner" class="form-control col-md-7 col-xs-12">
				</div>
			</div>
			<%--  <div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">维保企业：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					
					<input  value="${enterprise.name}" name="maintenanceEnterpriseId" required="required" class="form-control col-md-7 col-xs-12">
				
				</div> 
			</div> --%>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">签订日期：<span class="required">*</span>
				</label>
				<%-- <div class="col-md-6 col-sm-6 col-xs-12">
					<input  type="tel"  value="${Contract.sign_date}" name="sign_date" required="required" class="form-control col-md-7 col-xs-12"  maxlength="11"
					>
				</div> --%>
				<div class="col-md-6 col-sm-6 col-xs-12  xdisplay_inputx form-group has-feedback">
					<!-- 日历插件 -->
						<input type="date" value="" name="signDate" style="margin-left:15px" class="form-control has-feedback-left form_datetime" id="single_cal4" aria-describedby="inputSuccess2Status4"> 
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">结束日期：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12  xdisplay_inputx form-group has-feedback">
					<!-- 日历插件 -->
						<input value="" name="endDate"  type="date" style="margin-left:15px" class="form-control has-feedback-left form_datetime" id="single_cal4" aria-describedby="inputSuccess2Status4"> 
						
		
				</div>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">合同总价人民币（万元）：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  type="number"  value="" name="totalPrice" class="form-control col-md-7 col-xs-12" maxlength="11"
					>
				</div>
			</div>
		<div class="form-group" style="position:relative;">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">建筑物使用功能：<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
			
					<select id="buildingFunction" class="selectpicker form-control" data-live-search="true" name="building" onchange="changeF();">
					    <c:forEach items="${function}" var="function" >
							<option value="${function.functionName}"><c:out value="${function.functionName}"/></option>
						</c:forEach>
					</select>
				<input type="text" id="txt" value="" name="buildingFunction" style="position:absolute; width:90%; height:90%;top:1%;z-index:99; border:#FFF solid" />   
					
				</div>
			</div> 
			<div class="form-group" >
				
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="first-name">状态：<span class="required">*</span>
				</label>
				<label style="font-size:20px"><input value="已完成" name="status" type="radio" style="margin-left:80px;">已完成</label>
				<label style="font-size:20px"><input value="未完成" name="status" type="radio" style="margin-left:200px;">未完成</label>
			</div>
			<div class="form-group">
				<label class="control-label col-md-3 col-sm-3 col-xs-12"
					for="last-name">服务电话<span class="required">*</span>
				</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					<input  type="number"  value="" name="sevicePhone" class="form-control col-md-7 col-xs-12" maxlength="11"
					>
				</div>
			</div>
			
			<!-- 上传附件 -->
			<div class="form-group">
				<label for="middle-name"
					class="control-label col-md-3 col-sm-3 col-xs-12">附件：</label>
				<div class="col-md-6 col-sm-6 col-xs-12">
					 <input type="file" name="file" accept="pdf,doc,docx" value="${content1.accessory}">
							<span></span>
				</div>
			</div>
			<div class="form-group">
				<div class="col-md-6 col-sm-6 col-xs-12 col-md-offset-3" >
					<button type="submit" class="btn btn-success">提交</button>
					<a href="${path }/contract/showContract.htm" class="btn btn-primary" style="margin-left: 500px;">返回</a>
				</div>
			</div>
		</form>

	</div>
	
	
	<!-- Peity-->
	<script src="${path }/resources/js/plugins/peity/jquery.peity.min.js"></script>
	
	<!-- Bootstrap table-->
	<script src="${path }/resources/js/plugins/bootstrap-table/bootstrap-table.min.js"></script>
	<script src="${path }/resources/js/plugins/bootstrap-table/locale/bootstrap-table-zh-CN.min.js"></script>

	<!-- 自定义js-->
	<script src="${path }/resources/js/content.js?v=1.0.0"></script>
	
	<!-- jQuery Validation plugin javascript-->
    <script src="${path }/resources/js/plugins/validate/jquery.validate.min.js"></script>
    <script src="${path }/resources/js/plugins/validate/messages_zh.min.js"></script>
   
   	<!-- jQuery form  -->
    <script src="${path }/resources/js/jquery.form.min.js"></script>
    
    <!-- layer javascript -->
    <script src="${path }/resources/js/plugins/layer/layer.min.js"></script>
    <!-- 省市联动 -->
	<script src="${path }/resources/js/distpicker.data.js"></script>
	<script src="${path }/resources/js/distpicker.js"></script>
	<script src="${path }/resources/js/main.js"></script>
	    <!-- 表单验证 -->
<%--     <script src="${path }/resources/js/jquery.min.js"></script> --%>
    <script src="${path }/resources/js/jquery.validate.min.js"></script>
    <!-- datatables日期格式化 -->
	<script src="${path }/resources/js/moment.min.js"></script>
	 <!-- select可输入插件 -->
	<script type="text/javascript" src="${ contextPath }/res/sys/scripts/jquery.editable-select.min.js"></script>
	<script type="text/javascript">
	function changeF() {  
		 document.getElementById('txt').value = document.getElementById('buildingFunction').options[document.getElementById('buildingFunction').selectedIndex].value;  
	    }   
	</script>
	 <script type="text/javascript">
	$("#defaultForm").validate({
		onsubmit:true,// 是否在提交是验证
		onfocusout:false,// 是否在获取焦点时验证
		onkeyupd :false,// 是否在敲击键盘时验证
		
		rules:{
			projectName:{
				required:true
			},
			proprietorId:{
				required:true
			},
			projectCharge:{
				required:true,
			},
			address:{
				required:true,
			},
			signDate:{
				required:true,
				
			},
			endDate:{
				required:true,
			},
			totalPrice:{
				required:true
			},
			buildingFunction:{
				required:true,
				
			},
			status:{
				required:true
			},
			sevicePhone:{
				required:true,
			},
		},
		messages:{
			projectName:{
				required:"请输入项目名称"
			},
			proprietorId:{
				required:"请输入业主名称"
			},
			projectCharge:{
				required:"请输入项目负责人"
			},
			address:{
				required:"请输入详细地址"
			},
			signDate:{
				required:"请输入签订日期"
				
			},
			endDate:{
				required:"请输入签订日期"
			},
			totalPrice:{
				required:"请输入合同总价"
			},
			buildingFunction:{
				required:"请输入建筑使用功能"
				
			},
			status:{
				required:"请选择状态"
			},
			sevicePhone:{
				required:"请输入服务电话"
			},
		},
		submitHandler:function(form){//通过之后回调
			alert("添加成功！");
			form.submit();
		}
		
	});
	</script>
</body>
</html>